//
//  UnderLineBtn.m
//  Shengzhuli
//
//  Created by FXGuo on 2018/1/12.
//  Copyright © 2018年 kamangkeji. All rights reserved.
//

#import "UnderLineBtn.h"

@interface UnderLineBtn()
@property (nonatomic,weak) UIView *lineView;
@end

@implementation UnderLineBtn

- (void)awakeFromNib
{
    [super awakeFromNib];
    [self addLineView];
}
- (void)addLineView
{
    UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
    lineView.backgroundColor = RGBColor(234, 111, 90);
    lineView.hidden = YES;
    [self addSubview:lineView];
    self.lineView = lineView;
}
- (void)setSelected:(BOOL)selected
{
    [super setSelected:selected];
    if (selected) {
        self.lineView.hidden = NO;
    }else {
        self.lineView.hidden = YES;
    }
    
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    if (self.selected) {
        self.lineView.hidden = NO;
    }else {
        self.lineView.hidden = YES;
    }
    self.lineView.frame = CGRectMake(0, self.height-2, self.width, 2);
}

@end
